package com.itheima.job;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test06 {
    public static void main(String[] args) {
        //班级        ↓学生
        ArrayList<HashMap<Integer,Student1>> arrayList = new ArrayList<>();
        HashMap<Integer,Student1> hm1 = new HashMap<>();
        Student1 stu1 = new Student1(001,"zs",70.0);
        Student1 stu2 = new Student1(002,"ls",80.0);
        Student1 stu3 = new Student1(003,"ww",60.0);
        hm1.put(stu1.getNum(),stu1);
        hm1.put(stu2.getNum(),stu2);
        hm1.put(stu3.getNum(),stu3);

        arrayList.add(hm1);

        HashMap<Integer,Student1> hm2 = new HashMap<>();
        Student1 stu4 = new Student1(001,"aa",100.0);
        Student1 stu5 = new Student1(002,"bb",90.0);
        Student1 stu6 = new Student1(003,"cc",70.0);
        hm2.put(stu4.getNum(),stu4);
        hm2.put(stu5.getNum(),stu5);
        hm2.put(stu6.getNum(),stu6);

        arrayList.add(hm2);

        for (HashMap<Integer, Student1> hashMap : arrayList) {
            Set<Map.Entry<Integer, Student1>> entries = hashMap.entrySet();
            for (Map.Entry<Integer, Student1> entry : entries) {
                System.out.print(entry.getKey()+": ");
                System.out.println(entry.getValue());
            }
        }

    }
}
class Student1{
    private int num;//学号
    private String name;//姓名
    private double score;//分数
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public double getScore() {
        return score;
    }
    public void setScore(double score) {
        this.score = score;
    }
    public Student1(int num, String name, double score) {
        super();
        this.num = num;
        this.name = name;
        this.score = score;
    }
    public Student1() {}
    public String toString() {
        return "Student [num=" + num + ", name=" + name + ", score=" + score + "]";
    }
}
